package com.dys.teststatic;

/**
 * @className: com.dys.teststatic.Student
 * @description: com.dys.teststatic
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/07/15 下午8:50
 */
public class Student {
    String name;
    int age;
    /**
     * 静态属性,类变量
     */
    static String school;

    /**
     * 这是一个main()方法,是应用程序的入口
     *
     * @param args 方法的形参列表,是一个字符串数组,包含了从命令行传递给程序的参数
     */
    public static void main(String[] args) {
        Student.school = "清华大学";
        Student student = new Student();
        student.name = "张三";
        student.age = 18;
        // student.school = "清华大学";

        Student stu2 = new Student();
        stu2.name = "李四";
        stu2.age = 21;
        // stu2.school = "清华大学";

        // 访问属性
        System.out.println(student.name);
        System.out.println(student.age);
        System.out.println(student.school);
        System.out.println("---------------------");
        // 访问属性
        System.out.println(stu2.name);
        System.out.println(stu2.age);
        System.out.println(stu2.school);
    }
}
